package com.myway.controller;

import com.myway.dto.common.JsonData;
import com.myway.dto.param.OrderParam;
import com.myway.pojo.FlyOrder;
import com.myway.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: mashuai
 * @Date: 2018/8/13 18:27
 * @Version 1.0
 */
@Controller
@RequestMapping("/en/order")
public class OrderControllerEn {
    @Autowired
    private OrderService orderService;


    /**
     * @Author MaShuai
     * @Description 根据订单编号查询
     * @Date 2018/9/1 20:23
     * @Param [orderId]
     * @return com.myway.dto.common.JsonData
     **/
    @RequestMapping("/selectByOrderId")
    @ResponseBody
    public JsonData selectByOrderId(String orderId) {
        return orderService.selectByOrderId(orderId);
    }

    /**
     * 按条件查询订单
     *
     * @param param
     * @return
     */
    @RequestMapping("/selectByManyInf.json")
    @ResponseBody
    public JsonData selectByManyInf(OrderParam param) {
        return orderService.selectByManyInf(param);
    }

    /**
     * 返回总条数
     *
     * @param param
     * @return
     */
    @RequestMapping("/countOrder.json")
    @ResponseBody
    public JsonData countSearch(OrderParam param) {
        return orderService.countSearch(param);
    }

    /**
     * 添加机票订单
     * @param flyOrder
     * @return
     */
    @RequestMapping("/add")
    @ResponseBody
    public JsonData insertSelective(FlyOrder flyOrder) {
        return orderService.insertSelective(flyOrder);
    }

    /**
     * 删除机票订单
     * @param flyOrder
     * @return
     */
    @RequestMapping("/delete")
    @ResponseBody
    public JsonData deleteByPrimaryKey(FlyOrder flyOrder) {
        return orderService.deleteByPrimaryKey(flyOrder);
    }

    /**
     * 修改机票订单
     * @param flyOrder
     * @return
     */
    @RequestMapping("/update")
    @ResponseBody
    public JsonData updateByPrimaryKeySelective(FlyOrder flyOrder) {
        return orderService.updateByPrimaryKeySelective(flyOrder);
    }


    /**
     * @Author MaShuai
     * @Description 根据订单号查询订单详情信息
     * @Date 2018/8/23 11:10
     * @Param [orderId]
     * @return com.myway.dto.common.JsonData
     **/
    @RequestMapping("/selectOrderDetailsByOrderId")
    @ResponseBody
    public JsonData selectOrderDetailsByOrderId(String orderId) {
        return orderService.selectOrderDetailsByOrderId(orderId);
    }

    /**
     * @Author MaShuai
     * @Description 根据城市三字码获取城市信息
     * @Date 2018/8/23 11:10
     * @Param [citySZM]
     * @return com.myway.dto.common.JsonData
     **/
    @RequestMapping("/selectTabCityByCitySZM")
    @ResponseBody
    public JsonData selectTabCityByCitySZM(String citySZM) {
        return orderService.selectTabCityByCitySZM(citySZM);
    }

    /**
     * @Author MaShuai
     * @Description 根据机场三字码查询机场信息
     * @Date 2018/8/31 14:33
     * @Param [airportSZM]
     * @return com.myway.dto.common.JsonData
     **/
    @RequestMapping("/selectTabAirportManageByAirportNum")
    @ResponseBody
    public JsonData selectTabAirportManageByAirportNum(String airportNum){
        return orderService.selectTabAirportManageByAirportNum(airportNum);
    }
}
